Expand description
STFU-8: Sorta Text Format in UTF-8
STFU-8 is a hacky text encoding/decoding protocol for data that might be not quite UTF-8 but
is still mostly UTF-8. It is based on the syntax of the repr
created when you write (or
print) binary text in python, C or other common programming languages.
Its primary purpose is to be able to visualize and edit “data” that is mostly (or fully)
visible UTF-8 text. It encodes all non visible or non UTF-8 compliant bytes as longform
text (i.e. ESC which is \x1B
). It can also encode/decode ill-formed UTF-16 using the
encode_u16
and decode_u16
functions.
Basically STFU-8 is the text format you already write when use escape codes in C, python, rust,
etc. It permits binary data in UTF-8 by escaping them with \
, for instance \n
and \x0F
.
See the documentation for:
encode_u8
anddecode_u8
encode_u16
anddecode_u16
Also see the project README and consider starring it!
Structs
Enums
Functions
- Decode a UTF-8 string containing encoded STFU-8 into binary.
- Decode a UTF-8 string containing encoded STFU-8 into a
Vec<u16>
. - Encode text as STFU-8, escaping all non-printable or non UTF-8 bytes.
- Encode text as STFU-8, escaping all non-printable or non UTF-8 bytes EXCEPT:
- Encode UTF-16 as STFU-8, escaping all non-printable or ill-formed UTF-16 characters.
- Encode UTF-16 as STFU-8, escaping all non-printable or ill-formed UTF-16 characters EXCEPT: